home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / utilitys / 93 / ppaccell / pcpaccel.txt < prev    next >
Encoding:
Text File  |  1987-10-12  |  6.1 KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.     ACCELLERATING XMODEM TRANSFERS USING TIMED DELAYS
  9.  
  10.          by Thomas Zerucha / 24075 Lee Baker / Southfield, MI 48075
  11.  
  12.     The problem:
  13.          Telenet will not send a packet unless one of two things occurs:
  14.          1. 128 characters fill a complete packet
  15.          2. A programmable timeout occurs, normally 1/10th of a second
  16.             (this is set as 1/20th of a second multiplied by parameter
  17.               4, as in @SET 4:2<cr> is .1 sec, 4:3 is .15, 4:4 is .2 etc.).
  18.  
  19.          When transmitting Xmodem packets, the data will collect at your
  20.          end until 128 characters have been sent, and then be sent over the
  21.          network, and be sent (starting from the first character) out at the
  22.          far end.  Note that the first character goes out at the far end
  23.          AFTER the 128th character is sent (and usually later, since Telenet
  24.          is not instantaneous).  This 128 character delay is over 1 sec at
  25.          1200 baud, and 4-1/4 seconds at 300 baud.
  26.  
  27.          Fortunately, there is a way to speed things up a little by taking
  28.          advantage of the second transmit condition.
  29.  
  30.          WARNING: this method increases the number of packets sent.  Under
  31.          non-flat-rate conditions you are more likely to exceed your kilo-
  32.          packet limit and that may prove costly.  This is intended for
  33.          normal (evening and weekend) PC Pursuit hours.
  34.  
  35.     A Partial Solution:
  36.  
  37.          What would happen if we added a .1 second delay in the middle of
  38.          the block?  The packet would be sent half sooner.  So if we can
  39.          set up delays so that data would always be at the far end, and
  40.          the first packet would be sent as soon as possible, we would speed
  41.          up Xmodem transferrs quite a bit.  We have to be careful about
  42.          packing, as the following diagram shows:
  43.  
  44.          Transmitter:
  45.          TTTTTTTTTTTT---TTTTTTTTTTTT---.................*TTTTTTT->
  46.          Receiver:
  47.                    RRRRRRRRRRRR---RRRRRRRRRRRR*---
  48.  
  49.          * ack     '---' timeout delay
  50.  
  51.          Note that there is a delay in the receiver, not good if we want
  52.          peak performance.  The best way to fix this is to use shrinking
  53.          packets, the last packet being between 1 and 2 times the delay
  54.          time in length, i.e. a number of characters that would take
  55.          between .1 and .2 seconds to send, and then lengthening each
  56.          packet until the full XModem packet length is contained.  This
  57.          impacts the number of characters in the first packet - in the
  58.          last packet, it can be 4-7 characters and qualify.  But 4+8+...
  59.          adds to either 112 or 144.  Making the first packet too short
  60.          wouldn't speed things up as much as making everything perfect.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                                                     Accellerating Xmodem Page 2
  70.  
  71.  
  72.          so we have to add characters to each packet:
  73.  
  74.               112 =  28  24  20  16  12   8   4
  75.               +3 on each
  76.               133 =  31  27  23  19  15  11   7
  77.  
  78.          note that they still decrease by exactly 4.  If checksum is used
  79.          and 132 characters (which don't add exactly), any subpacket or group
  80.          of successive subpackets can be shortened by one, i.e for 130 chars
  81.  
  82.               130 =  30  26  22  19  15  11   7
  83.  
  84.          This will cause the following:
  85.  
  86.          TTTTTTTTTTTT---ttttttttt---TTTTTT---ttt---........*
  87.                    RRRRRRRRRRRRrrrrrrrrrRRRRRRrrr*---
  88.  
  89.          Values which work for 1200 Baud (the above is for 300) are
  90.  
  91.               133 = 52 39 27 15
  92.  
  93.          This works because each group fits within it's previous subpacket.
  94.  
  95.          Whatever delays inherent in the network will remain, however, there
  96.          will be a savings of .63 sec/Xmodem block @ 1200 Baud, and 2.2 sec
  97.          at 300 Baud.  This will not apply if Telenet is constantly changing
  98.          it's load, but this is rare in the off hours.  Graphically:
  99.  
  100.          TTTTTTTTTTTT---ttttttttt---TTTTTT---ttt---........*
  101.                      ppp        pppppp   p
  102.                      RRRRRRRRRRRR...rrrrrrrrrRRRRRRrrr*---
  103.  
  104.          p is the time it takes Telenet to send a packet
  105.  
  106.          But with a constant delay using accelleration:
  107.  
  108.          TTTTTTTTTTTT---ttttttttt---TTTTTT---ttt---.............*
  109.                      ppp        ppp      ppp   ppp         ppp
  110.                      RRRRRRRRRRRRrrrrrrrrrRRRRRRrrr*---
  111.  
  112.          The normal way:
  113.  
  114.          TTTTTTTTTTTTtttttttttTTTTTTttt---....................................*
  115.  
  116.                              ppp ppp                      ppp
  117.                              RRRRRRRRRRRRrrrrrrrrrRRRRRRrrr*---
  118.  
  119.     Notes:
  120.  
  121.          This technique is effective at accelerating any subpacket that can
  122.          be broken so that the largest packet is less than 128 characters
  123.          (minus .1 sec worth of characters - 116 for 1200 baud, or 124 for
  124.          300 baud).  So this will not help Ymodem (1k) packets, but will help
  125.          256 byte packets.  Also remember to add characters up to the maximum
  126.          length of .2 seconds, with many splits this can be significant.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.                                                     Accellerating Xmodem Page 3
  136.  
  137.  
  138.          (3 chars/block at 300 baud, 11 c/blk at 1200).  At 1200 Baud:
  139.  
  140.               133 = 52 39 27 15     <= optimal
  141.                      5  5  5 -15
  142.               133 = 57 44 32
  143.  
  144.          Note that both of these hold the property we are looking for, but
  145.          the first is 5 characters (.4 sec) longer for the first packet.
  146.          If the first number would be greater than 128, then the method
  147.          would not help significantly (since the delay would be 0 for the
  148.          129th character, but .1 sec otherwise).
  149.  
  150.          If we try to divide finer, we end up with packets smaller than the
  151.          delay, or bigger than the previous packet + delay:
  152.               133 = 48 36 24 12 13
  153.                      1  1  1  1 -4
  154.               133 = 49 37 25 13  9
  155.                      3  2  2  2 -9
  156.               133 = 52 39 27 15     <= optimal
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.